package ctgu.java;

import java.time.ZonedDateTime;

public class PhoneBillCaculator {
	private ZonedDateTime startingTime; //开始通话时间
    private ZonedDateTime endingTime;   //结束通话时间

    public PhoneBillCaculator(ZonedDateTime startingTime, ZonedDateTime endingTime) {
        this.startingTime = startingTime;
        this.endingTime = endingTime;
    }
    
    public double bill() {
    	long minute;
    	double bill;
    	HoldingTimeByZoned holdingTime = new HoldingTimeByZoned(startingTime, endingTime);
    	minute = holdingTime.getHoldingTime();
    	if(minute <= 20) {
    		bill = minute*0.05;
    	}
    	else {
    		bill = 1 + (minute-20)*0.1;
    	}
    	return bill;
    }
}
